<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>登录 - 淘乐乐商城</title>
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css">
    <style>
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }

        body {
            font-family: 'Microsoft YaHei', sans-serif;
            background-color: #f5f5f5;
            display: flex;
            justify-content: center;
            align-items: center;
            min-height: 100vh;
        }

        .login-container {
            background: white;
            padding: 30px;
            border-radius: 8px;
            box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
            width: 100%;
            max-width: 400px;
        }

        .logo {
            text-align: center;
            margin-bottom: 30px;
        }

        .logo a {
            color: #ff4d4f;
            font-size: 32px;
            text-decoration: none;
            font-weight: bold;
        }

        .form-group {
            margin-bottom: 20px;
        }

        .form-group label {
            display: block;
            margin-bottom: 8px;
            color: #333;
        }

        .form-group input {
            width: 100%;
            padding: 12px;
            border: 1px solid #ddd;
            border-radius: 4px;
            font-size: 16px;
        }

        .form-group input:focus {
            outline: none;
            border-color: #ff4d4f;
        }

        .login-btn {
            width: 100%;
            padding: 12px;
            background: #ff4d4f;
            color: white;
            border: none;
            border-radius: 4px;
            font-size: 16px;
            cursor: pointer;
            transition: background 0.3s;
        }

        .login-btn:hover {
            background: #ff6b6b;
        }

        .links {
            margin-top: 20px;
            text-align: center;
        }

        .links a {
            color: #666;
            text-decoration: none;
            margin: 0 10px;
        }

        .links a:hover {
            color: #ff4d4f;
        }

        .error-message {
            color: #ff4d4f;
            text-align: center;
            margin-bottom: 15px;
        }

        .register-link {
            text-align: center;
            margin-top: 20px;
            color: #666;
        }

        .register-link a {
            color: #ff4d4f;
            text-decoration: none;
            margin-left: 5px;
        }

        .register-link a:hover {
            text-decoration: underline;
        }
    </style>
</head>
<body>
    <div class="login-container">
        <div class="logo">
            <a href="taolele-mall.jsp">淘乐乐</a>
        </div>
        
        <!-- 显示错误信息 -->
        <% if (request.getAttribute("error") != null) { %>
            <div class="error-message">
                <%= request.getAttribute("error") %>
            </div>
        <% } %>

        <form action="${pageContext.request.contextPath}/login" method="post">
            <div class="form-group">
                <label for="username">用户名</label>
                <input type="text" id="username" name="username" required>
            </div>
            
            <div class="form-group">
                <label for="password">密码</label>
                <input type="password" id="password" name="password" required>
            </div>
            
            <button type="submit" class="login-btn">登录</button>
        </form>
        
        <div class="links">
            <a href="register.jsp">立即注册</a>
            <a href="#">忘记密码</a>
            <a href="taolele-mall.jsp">返回首页</a>
        </div>

        <div class="register-link">
            还没有账号？<a href="register.jsp">立即注册</a>
        </div>
    </div>

    <script>
        // 如果是在iframe中，跳转到顶层窗口
        if (window != window.top) {
            window.top.location.href = window.location.href;
        }
    </script>
</body>
</html> 